package org.feichao.imagegenerator;

import java.awt.*;

/**
 * @author zhangzc@djcars.cn
 * @create 2016/9/2
 */
public class CircleBean extends Drawable {

    public int centerX;

    public int centerY;

    public int r;

    public int border;

    public Color borderColor = Color.BLACK;

    public Color filledColor = Color.WHITE;

    public CircleBean(int centerX, int centerY, int r, int border, Color borderColor, Color filledColor) {
        this.centerX = centerX;
        this.centerY = centerY;
        this.r = r;
        this.border = border;
        this.borderColor = borderColor;
        this.filledColor = filledColor;
    }

    @Override
    void doDraw(Context context) throws Exception {
        Graphics2D g=context.canvas.createGraphics();
        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
        g.setColor(borderColor);
        g.fillOval(centerX-r,centerY-r,r*2,r*2);
        g.setColor(filledColor);
        g.fillOval(centerX-r+border,centerY-r+border,(r-border)*2,(r-border)*2);
        g.dispose();
    }
}
